#include"searcher.h"



int main()
{
  searcher::Index index;
  bool ret = index.Build("../data/tmp/row_input"); 
  if(!ret)
  {
    cout<<"构建倒排索引失败"<<endl;
    return 1;
  }

  //如果构建索引成功，就调用索引中的相关函数（查正排，查倒排）
  auto* inverted_list = index.GetInvertedList("split"); 
  for(const auto weight : *inverted_list)
  {
    cout<<"string: "<< weight.word <<"id: "<< weight.doc_id << "weight: " << weight.weight << endl; 
    //const searcher::DocInfo* doc_info = index.GetDocInfo(weight.doc_id);
    auto* doc_info = index.GetDocInfo(weight.doc_id);
    cout<<"title: "<< doc_info->title<<endl;
    cout<<"URL: "<< doc_info->url<<endl;
    cout<<"======================================================"<<endl;
  }



  return 0;
}
